//
//  CoreXMLParser.h
//  StarBugs
//
//  Created by ?? ? on 12/28/11.
//  Copyright 2011 antisword@playorca.com. All rights reserved.
//

#ifndef __CORE__APPLICATION__PARSER__
#define __CORE__APPLICATION__PARSER__

//#include "CCSAXParser.h"
#include "cocos2d.h"

struct MySpriteVar{
    
    int x;
    int y;
    int w;
    int h;
    char name[32];
    
    bool operator == (const MySpriteVar &other) const
    {
        return (strcmp(name, other.name) == 0);
    }
};

class CoreXMLParser :public cocos2d::CCSAXDelegator
{
private:
    cocos2d::CCRect ImageRect;
    char rectName[32];
    char imageName[32];
public:
//    CoreXMLParser(char *file);
    std::vector<MySpriteVar>_spriteVar;
    CoreXMLParser();
    bool initParsing(const char* fileName, const char* rectName);
    bool initParsing(const char* fileName);
    void parseXMLFile();
    void startElement(void *ctx, const char *name, const char **atts);
    void endElement(void *ctx, const char *name);
    void textHandler(void *ctx, const char *s, int len);
    const char *animFile;   
    cocos2d::CCRect getRect();
    char *getImageName();
};
#endif